package com.ecfront.util.email;
/**
 * 注册邮件封装类
 * @author 
 */
public class RegistContext implements MailContext {
	
	private static final String PARM = "[$]{1}\\{username\\}";//要替换掉模板里的用户名
	private static final String REGIST = "regist";
	
	private String toEmail;//邮件接收者地址
	private String name;//邮件接收者名
	private String body;//邮件内容
	//Spring注入标题和正文相对路径
	private String subject;
	private String file;	
	public void setSubject(String subject) {
		this.subject = subject;
	}
	public void setFile(String file) {
		this.file = file;
	}

	public String getEmailBody() {
		String path = MailUtil.getSystemPath() + file;
		body = MailUtil.getFileContextByPath(path);
		body = body.replaceAll(PARM, name);
		return body;
	}

	public String getName() {
		return name;
	}

	public String getSubject() {
		return subject;
	}

	public String getToEmail() {
		return toEmail;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setToEmail(String toEmail) {
		this.toEmail = toEmail;
	}
}
